<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common.jsp"%>
<!-- 分页表单：搜索表单必须添加属性： rel="pagerForm"  -->
<%@include file="/pageParameter.jsp" %>
<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="${ctxPath }/task/taskJob/list"
		method="post">
		<div class="searchBar">
			<table class="searchContent">
				<tr>
				    <td>任务名称： <input type="text" name="jobName" value="${entity.jobName}" /></td>
                    <td>
						<div class="buttonActive">
							<div class="buttonContent">
							     <button title="查询" type="submit">查&nbsp;询</button>
							</div>
						</div>
					</td>
                 </tr>
			</table>
		</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
				<shiro:hasPermission name="task/taskJob/add">
					<li>
						<a title="添加定时任务" class="add"
							href="${ctxPath }/task/taskJob/addUI" target="dialog" 
							mask="true" width="750" height="500" rel="input" ><span>添加</span>
						</a>
					</li>
					<li class="line">line</li>
				</shiro:hasPermission>
				<shiro:hasPermission name="task/taskJob/edit"> 
					<li>
						<a title="修改" class="edit" target="dialog"
							href="${ctxPath}/task/taskJob/editUI?id={param_id}" 
							warn="请选择要操作的数据"
						 	mask="true" width="550" height="600"><span>修改</span></a>
					</li>
					<li class="line">line</li>
				</shiro:hasPermission>
				<shiro:hasPermission name="task/taskJob/delete">	
					<li>
						<a title="确定要删除该记录吗？" class="delete"  target="ajaxTodo"
							href="${ctxPath}/task/taskJob/delete?id={param_id}" 
							warn="请选择要操作的数据"><span>删除</span></a>
					</li>
					<li class="line">line</li>
				</shiro:hasPermission>	
				<shiro:hasPermission name="task/taskJob/run">
		        	<li>
						<a title="确定要立即执行该任务吗？" class="icon"  target="ajaxTodo"
							href="${ctxPath}/task/taskJob/run?id={param_id}" warn="请选择要操作的数据" >
							<span>立即执行</span></a>
					</li>
					<li class="line">line</li>
				</shiro:hasPermission>
		</ul>
	</div>
	<table class="table" width="101%" layoutH="109">
		<thead>
			<tr>
				<th width="5%" >序号</th>
				<th width="10%" orderField="jobName" class="${pageParam.orderField eq 'jobName' ? pageParam.orderDirection : ''}">任务名称</th>
				<th width="10%" orderField="jobGroup" class="${pageParam.orderField eq 'jobGroup' ? pageParam.orderDirection : ''}">任务分组</th>
				<th width="5%" orderField="jobStatus" class="${pageParam.orderField eq 'jobStatus' ? pageParam.orderDirection : ''}">启动状态</th>
				<th width="8%">cron表达式</th>
				<th width="5%" orderField="beanId" class="${pageParam.orderField eq 'beanId' ? pageParam.orderDirection : ''}">BeanId</th>
				<th width="15%" orderField="beanClass" class="${pageParam.orderField eq 'beanClass' ? pageParam.orderDirection : ''}">beanClass</th>
				<th width="5%" orderField="isConcurrent" class="${pageParam.orderField eq 'isConcurrent' ? pageParam.orderDirection : ''}">并发状态</th>
				<th width="10%" orderField="createTime" class="${pageParam.orderField eq 'createTime' ? pageParam.orderDirection : ''}">创建时间</th>
				<th width="5%">描述</th>
				<th >操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="item" items="${pageBean.recordList}" varStatus="s">
				<!-- 
				当选中一行时,tr上的rel值会自动替换到url变量中.
				注意url变量名{sid_user}和tr的target="sid_user"保持一致.
				 -->
				<tr target="param_id" rel="${item.id}">
					<td>${s.index + 1}</td>
					<td>${item.jobName}</td>
					<td>${item.jobGroup}</td>
					<td>
						<c:if test="${item.jobStatus==0}">不启动</c:if>
						<c:if test="${item.jobStatus==1}">启动</c:if>
					</td>
					<td>${item.cron}</td>
					<td>${item.beanId}</td>
					<td>${item.beanClass}</td>
					<td>
						<c:if test="${item.isConcurrent==0}">不并发</c:if>
						<c:if test="${item.isConcurrent==1}">并发</c:if>
					</td>
					<td><fmt:formatDate value="${item.createTime}"
					     pattern="yyyy-MM-dd HH:mm:ss" />
			        </td>
			        <td>${item.description}</td>
			        <td>
				        <!-- 不启动 -->
				        <c:if test="${item.jobStatus==0}">
				        	<shiro:hasPermission name="task/taskJob/resume">
					        	&nbsp;[
								<a href="${ctxPath}/task/taskJob/resume?id=${item.id}" title="恢复任务" target="ajaxTodo"  style="color: blue">恢复任务</a>
								]
							</shiro:hasPermission>
				        </c:if>
				        <!-- 启动 -->
				        <c:if test="${item.jobStatus==1}">
				        	<shiro:hasPermission name="task/taskJob/pause">
					        	&nbsp;[
								<a href="${ctxPath}/task/taskJob/pause?id=${item.id}" title="暂停任务" target="ajaxTodo"  style="color: blue">暂停任务</a>
								]
							</shiro:hasPermission>
				        </c:if>
			        </td>
				</tr>
			</c:forEach>
			<c:if test="${pageBean.totalCount==0}"><tr><td>暂无数据</td></tr></c:if>
		</tbody>
	</table>
	<%@include file="/pageBar.jsp" %>
</div>
